λ npx expo prebuild
https://gyazo.com/c2506ad77981c403ee3f361f41778f8c https://blog.expo.dev/expo-managed-workflow-in-2021-d1c9b68aa10
projectに対するnative runtime codeを生成する
毎回のbuild前に行うλ expo ejectのようなイメージ
ReactとTypeScriptのみで開発しつつも、native codeを追加することができる
EASの誕生の経緯の内容が前提にあるので、これを知らないとたぶん理解できない
fyi
https://github.com/expo/expo/blob/main/docs/pages/guides/adopting-prebuild.mdx
実行すると、ios/とandroid/が生成される
生成されたものは基本触らない
native codeに対して手を加える時は、app.jsonに書く
そのlibraryがConfig Pluginsを提供していればapp.jsonに書くだけで済む
そうなっていない場合は、ios/の内部を書き換える必要があることもある
New libraries can be added by installing them with npm or yarn, then adding them to the plugins array of your Expo config (app.json or app.config.js), running expo prebuild will ensure ref
eas.jsonの内容は関係ない
使用していないlibraryが削除される
使用しているもののみがlinkされる
恐らくExpo SDKのみの話 #??
commands ref
$ expo prebuild -p ios
-pは--platformと同じ
ios or android or all
$ expo prebuild --clean
native foldersを削除した後に、再作成する
$ expo config --type prebuild
#??
ejectとの違い
ejectは1回のみ行うことを想定している
prebuildは、buildごとに行うことを想定している
#WIP
何が行われるか ref
1 ios/とandroid/にdefaultの実装をコピー
2 Ensure the project is no longer using the Expo fork of react-native which has sandboxed AsyncStorage and disables the DevMenu for use in the Expo Go app.
よくわからんmrsekut.icon
3 app.jsonとapp.config.jsonを見て、使用するConfig Pluginsの一覧を取得
4 CocoaPodsのinstallとlink
5 config modsをevalして、ios/とandoird/に変更を加える
e.g.
name -> rename ios name and android name
icon -> generate icons
splash -> generate splash screens
雑に言えばこんな感じらしい
CocoaPods、Autolinking、Config Pluginsを実装したNative Modulesをlinkおよび構成する
native codeのbundlerのようなイメージ
雑に言えばwebpackと同じmrsekut.icon
webpackにおけるwebpack.config.jsが、prebuildにおけるapp.json
prebuildにも問題が残る ref
まだ全てのpacakgeにConfig Pluginsがあるわけではない
#??
あるpackageがnative codeに依存しているかどうかを調べる
react native directoryを使用する
https://reactnative.directory/
「Expo Go」と書いていれば使われていない
何も設定しなくて良い
「Expo Go」が書いていない場合は追加の設定が必要になる
↑たぶん違うmrsekut.icon
Now open your package.json and take note of any package in your dependencies object that has native code. You can check reactnative.directory and see if they say "Expo Go", if they don't then they might need extra setup. ref
Migratingの箇所ちゃんと理解していない
https://github.com/expo/fyi/blob/b2e1c97e5f0549b90cfe7eb91a4651e041ff0fe4/prebuilding.md#migrating
https://docs.expo.dev/workflow/customizing/